package main

import (
	"jtvss/api"
	"jtvss/configs"
	"jtvss/initialize"
	"jtvss/pkg/svc"
	"log"
	"os"
)

// @title Swagger Example API
// @version 1.0
// @description This is a sample server celler server.
// @termsOfService http://swagger.io/terms/
func main() {
	if err := configs.Load("config.yaml"); err != nil {
		log.Fatal(err)
	}
	svc.Run(&svc.Program{
		AppName: func() string {
			if len(os.Args) > 2 {
				configs.AppName = os.Args[2]
			}
			return configs.AppName
		},
		Description: "jtvss service application",
		Run: func() error {
			if err := initialize.Start(); err != nil {
				return err
			}
			return api.Run()
		},
		Shutdown: func() error {
			return api.Shutdown()
		},
	})
}
